package com.situ.cst.controller;

import com.situ.util.dao.CstLostDao;
import com.situ.util.entity.CstLost;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.situ.cst.service.CstActivityService;
import com.situ.cst.entity.CstActivity;
import com.situ.util.*;
/**
 * CstActivity的路由接口服务
 * 
 * @author 
 *
 */

@RestController
public class CstActivityController {
	/** CstActivityService服务 */
	@Autowired
	private CstActivityService cstActivityService;
	
	/**
	 * 查询所有CstActivity数据的方法
	 * @param value
	 * @return
	 */
	@RequestMapping(value = "queryCstActivity", produces = {"application/json;charset=UTF-8"})
	public ResponseData find(CstActivity value) {

		return ResponseData.ok().putDataValue("list",cstActivityService.find(value));
	}
	
	/**
	 * 通过id查询CstActivity数据的方法
	 * @param id
	 * @return
	 */
	@RequestMapping(value = "queryCstActivityById/{id}", produces = {"application/json;charset=UTF-8"})
	public ResponseData findOne(@PathVariable(name="id") Integer id) {
		 return ResponseData.ok().putDataValue("obj",cstActivityService.findOne(id));
	}
	
	/**
	 * 插入CstActivity属性不为空的数据方法
	 * @param id
	 * @return
	 */
	@RequestMapping(value = "saveCstActivity")
	public ResponseData save(CstActivity value) {
		return ResponseData.ok().putDataValue("obj", cstActivityService.saveNotNull(value));
	}
	
	/**
	 * 更新CstActivity属性不为空的数据方法
	 * @param id
	 * @return
	 */
	@RequestMapping(value = "updateCstActivity", produces = {"application/json;charset=UTF-8"})
	public ResponseData update(CstActivity value) {
		return ResponseData.ok().putDataValue("obj",cstActivityService.updateNotNullById(value));
	}

	/**
	 * 通过id删除CstActivity数据方法
	 * @param id
	 * @return
	 */
	@RequestMapping(value = "delCstActivityById/{id}", produces = {"application/json;charset=UTF-8"})
	public ResponseData delete(@PathVariable(name="id") Integer id) {
		return ResponseData.ok().putDataValue("obj",cstActivityService.deleteById(id));
	}
}
